using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace ibba.src.noriskbo.code.converter
{
    public class RunOffConverter : IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return ((bool)value ? "Sim" : "");
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string strValue = value.ToString();
            bool resultValue;

            if (bool.TryParse(strValue, out resultValue))
            {
                return resultValue;
            }
            return value;
        }
    }
}
